﻿using System;
using System.Windows.Forms;

namespace ShippingManage
{
	public partial class frmMain : Form
	{
		public frmMain()
		{
			InitializeComponent();
		}

		#region form

		Form _AirWayBill = null;
		public Form AirWayBill
		{
			get
			{
				if (_AirWayBill == null || _AirWayBill.IsDisposed)
				{
					_AirWayBill = new frmAirWayBill();
					_AirWayBill.MdiParent = this;
				}
				return _AirWayBill;
			}
		}

		Form _Shipping = null;
		public Form Shipping
		{
			get
			{
				//if (_Shipping == null || _Shipping.IsDisposed)
				//  _Shipping = new frmShipping();
				return _Shipping;
			}
		}

		Form _CargoManifest = null;
		public Form CargoManifest
		{
			get
			{
				if (_CargoManifest == null || _CargoManifest.IsDisposed)
				{
					_CargoManifest = new Reports.frmCargoManifest();
					_CargoManifest.MdiParent = this;
				}
				return _CargoManifest;
			}
		}

		Form _Logging = null;
		public Form Logging
		{
			get
			{
				if (_Logging == null || _Logging.IsDisposed)
				{
					_Logging = new frmLogging();
					_Logging.MdiParent = this;
				}
				return _Logging;
			}
		}

		#endregion

		private void btnAirWayBill_Click(object sender, EventArgs e)
		{
			AirWayBill.Show();
		}

		private void btnShipping_Click(object sender, EventArgs e)
		{
			Shipping.Show();
		}

		private void LogingButton_Click(object sender, EventArgs e)
		{
			Logging.Show();
		}

		private void CargoManifestButton_Click(object sender, EventArgs e)
		{
			CargoManifest.Show();
		}

		private void newToolStripMenuItem_Click(object sender, EventArgs e)
		{
			((IForm)this.ActiveMdiChild).New();
		}

		private void saveToolStripMenuItem_Click(object sender, EventArgs e)
		{
			((IForm)this.ActiveMdiChild).Save();
		}

		private void printToolStripMenuItem_Click(object sender, EventArgs e)
		{
			((IForm)this.ActiveMdiChild).Print();
		}

		private void exitToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.Close();
		}
	}
}
